<?php
namespace app\erp_meixingtiyu\controller;

use think\facade\Request;
use app\store\controller\Controller as StoreController;
use app\erp_meixingtiyu\logic\CourseLesson as CourseLessonLogic;

class CourseLesson extends StoreController
{
    public function list($courseId)
    {
        $list = (new CourseLessonLogic())->getList($courseId);
        return $this->renderSuccess($list);
    }

    public function add()
    {
        $params = Request::only([
            'course_id',
            'name',
            'class_date',
            'class_time',
            'class_place',
            'sort',
        ]);

        (new CourseLessonLogic())->addLesson($params);
        return $this->renderSuccess('添加成功');
    }

    public function edit()
    {
        $params = Request::only([
            'lesson_id',
            'name',
            'class_date',
            'class_time',
            'class_place',
            'sort',
        ]);

        (new CourseLessonLogic())->editLesson($params);
        return $this->renderSuccess('编辑成功');
    }

    public function del($lessonId)
    {
        (new CourseLessonLogic())->deleteLesson($lessonId);
        return $this->renderSuccess('删除成功');
    }
   
}
